var gulp = require('gulp');
var babel = require('gulp-babel');
var livereload = require('gulp-livereload');

// build es6 to es5 with babel
gulp.task('default', function () {
    gulp.src('./app/assets/js/*.js')
        .pipe(babel({
            presets: ['react', 'es2015']
        }))
        .pipe(gulp.dest('./public/js'))
        .pipe(livereload());						// live reload
});

// watch for changes
gulp.task('watch', function () {
    livereload.listen();         					// live reload
    gulp.watch([
        './app/assets/js/*.js'
    ], [
        'default'
    ]);
});